package com.example.myapplication.livedata.model;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.myapplication.bean.ProductInfo;

/**
 * Created by xiaolong on 2022/1/6 5:42 下午
 * email：xinxiaolong123@foxmail.com
 */
public class LiveDataViewModel extends ViewModel {

    MutableLiveData<ProductInfo> mutableLiveData = new MutableLiveData<>();

    public MutableLiveData<ProductInfo> getMutableLiveData() {
        return mutableLiveData;
    }

    public void setProduct(ProductInfo productInfo) {
        mutableLiveData.setValue(productInfo);
    }

    public void setProduct(MutableLiveData<ProductInfo> mutableLiveData ) {
        this.mutableLiveData=mutableLiveData;
    }

}
